﻿using Avalonia.Controls.ApplicationLifetimes;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using XT.Common;
using XT.Common.Interfaces;
using XT.Common.Services;
using XT.Common.Extensions;
using AvaDemo.ViewModels;
using AvaDemo.Views;

namespace AvaDemo
{
    public static class Register
    {
        public static IServiceProvider App;
       
        /// <summary>
        /// 初始化服务
        /// </summary>
        /// <param name="services"></param>
        /// <returns></returns>
        public static ServiceCollection InitialXTServices(this ServiceCollection services)
        {
           

            // Viewmodels
            services.AddSingleton<MainViewModel>();


            services.AddSingleton<IApiConfig, ApiConfigService>();

            services.AddOriginHttpClient();
            return services;
        }

        public static void InitialCompleted(this IApplicationLifetime lifetime, IServiceProvider provider)
        {
            App = provider;

        }



    }
}
